﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TravelLink.WebModel;

namespace TravelLink.WebApp.Member {
    public partial class ActiveEmail : Pagebase {



        protected void Page_Load(object sender, EventArgs e) {

            #region nav
            NavQueue nav = new NavQueue();
            nav.Enqueue(new NavItem {
                Title = "用户激活",
                Url = "javascript:void(0)"
            });

            this.SetNav(nav);
            #endregion




            Guid userId = new Guid(WebHelper.GetQueryStringStr("m", Guid.Empty.ToString()));
            string userEmail = WebHelper.GetQueryStringStr("ml");

            var user = this.DB.TL_User.Where(u => u.UserCode == userId).FirstOrDefault();
            if (user != null) {
                user.Status = 1;

                this.DB.SubmitChanges();

                if (UserController.GetInstance().Login(userEmail, user.Password) == "OK") {
                    Response.Redirect(Consts.Member_Default);
                }
            }
        }



    }
}